package com.witframework.web.tag;


import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.Tag;

public class TopWindowTag
  implements Tag
{
  private PageContext pageContext;
  private Tag parent;
  private boolean cond = true;

  public void setCond(boolean paramBoolean)
  {
    this.cond = paramBoolean;
  }

  public boolean getCond()
  {
    return this.cond;
  }

  public int doStartTag()
    throws JspException
  {
    return 0;
  }

  public int doEndTag()
    throws JspException
  {
    if (this.cond)
    {
      StringBuffer localStringBuffer = new StringBuffer("\n<script language=\"JavaScript\">\n");
      localStringBuffer.append("if (window!=top) { top.location.href=location.href; }\n");
      localStringBuffer.append("</script>\n");
      try
      {
        this.pageContext.getOut().write(localStringBuffer.toString());
      }
      catch (IOException localIOException)
      {
        throw new JspException("IO Error: " + localIOException.getMessage());
      }
    }
    dropData();
    return 6;
  }

  public void setPageContext(PageContext paramPageContext)
  {
    this.pageContext = paramPageContext;
  }

  public void setParent(Tag paramTag)
  {
    this.parent = paramTag;
  }

  public Tag getParent()
  {
    return this.parent;
  }

  public void release()
  {
    dropData();
  }

  private void dropData()
  {
    this.cond = true;
  }
}